

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/favicon.png">
  <link rel="icon" href="/img/favicon.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="Fly542">
  <meta name="keywords" content="">
  
    <meta name="description" content="windows安装 按下图依次点击进入二进制安装包下载页面  下载安装包     ①Static里面只有3个应用程序：ffmpeg.exe，ffplay.exe，ffprobe.exe，每个exe的体积都很大，相关的Dll已经被编译到exe里面去了。 ②Shared里面除了3个应用程序之外，还有一些Dll，比如说avcodec-54.dll之类的。Shared里面的exe体积很小，他们在运行的时候">
<meta property="og:type" content="article">
<meta property="og:title" content="windows 下安装ffmpeg及简单使用">
<meta property="og:url" content="http://fly542.cn/2024/09/30/07%E5%BA%94%E7%94%A8/01windows%E4%B8%8B%E5%AE%89%E8%A3%85ffmpeg/index.html">
<meta property="og:site_name" content="Fly542 技术沉淀">
<meta property="og:description" content="windows安装 按下图依次点击进入二进制安装包下载页面  下载安装包     ①Static里面只有3个应用程序：ffmpeg.exe，ffplay.exe，ffprobe.exe，每个exe的体积都很大，相关的Dll已经被编译到exe里面去了。 ②Shared里面除了3个应用程序之外，还有一些Dll，比如说avcodec-54.dll之类的。Shared里面的exe体积很小，他们在运行的时候">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://fly542.cn/2024/09/30/07%E5%BA%94%E7%94%A8/01windows%E4%B8%8B%E5%AE%89%E8%A3%85ffmpeg/1.jpg">
<meta property="article:published_time" content="2024-09-30T00:19:40.000Z">
<meta property="article:modified_time" content="2024-09-30T00:34:20.674Z">
<meta property="article:author" content="Fly542">
<meta property="article:tag" content="ffmpeg">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="http://fly542.cn/2024/09/30/07%E5%BA%94%E7%94%A8/01windows%E4%B8%8B%E5%AE%89%E8%A3%85ffmpeg/1.jpg">
  
  
  <title>windows 下安装ffmpeg及简单使用 - Fly542 技术沉淀</title>

  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4/dist/css/bootstrap.min.css" />


  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/github-markdown-css@4/github-markdown.min.css" />
  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/hint.css@2/hint.min.css" />

  
    
    
      
      <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/highlight.js@10/styles/github-gist.min.css" />
    
  

  
    <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3/dist/jquery.fancybox.min.css" />
  


<!-- 主题依赖的图标库，不要自行修改 -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_ba1fz6golrf.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />

<!-- 自定义样式保持在最底部 -->


  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    var CONFIG = {"hostname":"fly542.cn","root":"/","version":"1.8.14","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"right","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"copy_btn":true,"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/local-search.xml"};
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
<meta name="generator" content="Hexo 6.0.0"></head>


<body>
  <header style="height: 70vh;">
    <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>Fly542 技术沉淀</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                首页
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                归档
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                分类
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                标签
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                关于
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              &nbsp;<i class="iconfont icon-search"></i>&nbsp;
            </a>
          </li>
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">&nbsp;<i
                class="iconfont icon-dark" id="color-toggle-icon"></i>&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

    <div class="banner" id="banner" parallax=true
         style="background: url('/img/default.png') no-repeat center center;
           background-size: cover;">
      <div class="full-bg-img">
        <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
          <div class="page-header text-center fade-in-up">
            <span class="h2" id="subtitle" title="windows 下安装ffmpeg及简单使用">
              
            </span>

            
              <div class="mt-3">
  
  
    <span class="post-meta">
      <i class="iconfont icon-date-fill" aria-hidden="true"></i>
      <time datetime="2024-09-30 08:19" pubdate>
        2024年9月30日 早上
      </time>
    </span>
  
</div>

<div class="mt-1">
  
    <span class="post-meta mr-2">
      <i class="iconfont icon-chart"></i>
      1.9k 字
    </span>
  

  
    <span class="post-meta mr-2">
      <i class="iconfont icon-clock-fill"></i>
      
      
      17 分钟
    </span>
  

  
  
</div>

            
          </div>

          
        </div>
      </div>
    </div>
  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="d-none d-lg-block col-lg-2"></div>
    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div class="py-5" id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">windows 下安装ffmpeg及简单使用</h1>
            
            <div class="markdown-body">
              <h1 id="windows安装"><a href="#windows安装" class="headerlink" title="windows安装"></a>windows安装</h1><ul>
<li><p>按下图依次点击进入二进制安装包下载页面</p>
<img src="/2024/09/30/07%E5%BA%94%E7%94%A8/01windows%E4%B8%8B%E5%AE%89%E8%A3%85ffmpeg/1.jpg" srcset="/img/loading.gif" lazyload class=""></li>
<li><p>下载安装包</p>
</li>
</ul>


<p>①Static里面只有3个应用程序：ffmpeg.exe，ffplay.exe，ffprobe.exe，每个exe的体积都很大，相关的Dll已经被编译到exe里面去了。</p>
<p>②Shared里面除了3个应用程序之外，还有一些Dll，比如说avcodec-54.dll之类的。Shared里面的exe体积很小，他们在运行的时候，到相应的Dll中调用功能。</p>
<p>③Dev版本是用于开发的，里面包含了库文件xxx.lib以及头文件xxx.h，这个版本不包含exe文件。</p>
<ul>
<li>ffmpeg安装</li>
</ul>
<p>下载完成后直接进行解压，然后配置环境变量就OK了，非常方便。</p>
<blockquote>
<p>环境变量配置方法：点击系统属性窗口中的环境变量按钮。在“用户变量”区域选择Path变量，点击编辑按钮，在其原始内容后输入ffmpeg的bin路径，例如”D:\Program Files\ffmpeg”。下面有图示</p>
</blockquote>


<ul>
<li>验证ffmpeg是否安装成功</li>
</ul>
<p>打开命令提示符窗口。输入命令”ffmpeg –version”。<br>如果命令提示窗口返回FFmpeg的版本信息，那么就说明安装成功了。</p>



<h1 id="根据ts和m3u8转mp4脚本"><a href="#根据ts和m3u8转mp4脚本" class="headerlink" title="根据ts和m3u8转mp4脚本"></a>根据ts和m3u8转mp4脚本</h1><figure class="highlight bash"><table><tr><td class="gutter"><div class="code-wrapper"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br></pre></div></td><td class="code"><pre><code class="hljs bash"><span class="hljs-meta">#!/bin/bash</span><br><br><span class="hljs-built_in">cd</span> `dirname <span class="hljs-variable">$0</span>`<br><br><span class="hljs-comment"># 当前目录</span><br>current_dir=<span class="hljs-string">&quot;<span class="hljs-subst">$(cd <span class="hljs-string">&quot;<span class="hljs-subst">$(dirname <span class="hljs-string">&quot;<span class="hljs-variable">$0</span>&quot;</span>)</span>&quot;</span> &amp;&amp; pwd)</span>&quot;</span><br><br><span class="hljs-comment"># 初始化目录序号</span><br>index=1<br><br><span class="hljs-comment"># 存放原始所有ts文件夹的目录</span><br>ts_parent_dir=<span class="hljs-string">&quot;./测试-ts&quot;</span><br><br><span class="hljs-comment"># 设置目标目录</span><br>target_dir=<span class="hljs-string">&quot;<span class="hljs-variable">$&#123;current_dir&#125;</span>/测试&quot;</span><br><br><span class="hljs-comment"># 文件前缀</span><br>pre_str=<span class="hljs-string">&quot;测试-&quot;</span><br><br><span class="hljs-comment"># 如果目标目录不存在，创建该目录</span><br><span class="hljs-keyword">if</span> [ ! -d <span class="hljs-string">&quot;<span class="hljs-variable">$target_dir</span>&quot;</span> ]; <span class="hljs-keyword">then</span><br>    mkdir -p <span class="hljs-string">&quot;<span class="hljs-variable">$target_dir</span>&quot;</span><br><span class="hljs-keyword">fi</span><br><br><span class="hljs-comment"># 进入ts父目录</span><br><span class="hljs-built_in">cd</span> <span class="hljs-string">&quot;<span class="hljs-variable">$ts_parent_dir</span>&quot;</span><br><span class="hljs-comment"># 遍历当前目录下的所有子目录</span><br><span class="hljs-keyword">for</span> dir <span class="hljs-keyword">in</span> */; <span class="hljs-keyword">do</span><br>    <span class="hljs-comment"># 确保是一个目录</span><br>    <span class="hljs-keyword">if</span> [ -d <span class="hljs-string">&quot;<span class="hljs-variable">$dir</span>&quot;</span> ]; <span class="hljs-keyword">then</span><br>        <span class="hljs-built_in">echo</span> <span class="hljs-string">&quot;Processing directory #<span class="hljs-variable">$index</span>: <span class="hljs-variable">$dir</span>&quot;</span><br><br>        <span class="hljs-comment"># 进入子目录</span><br>        <span class="hljs-built_in">cd</span> <span class="hljs-string">&quot;<span class="hljs-variable">$dir</span>&quot;</span> || <span class="hljs-built_in">exit</span><br><br>        <span class="hljs-comment"># 查找并处理 .m3u8 文件</span><br>        <span class="hljs-keyword">for</span> file <span class="hljs-keyword">in</span> *.m3u8; <span class="hljs-keyword">do</span><br>            <span class="hljs-keyword">if</span> [ -f <span class="hljs-string">&quot;<span class="hljs-variable">$file</span>&quot;</span> ]; <span class="hljs-keyword">then</span><br>                <span class="hljs-comment"># 格式化序号为两位数</span><br>                formatted_index=$(<span class="hljs-built_in">printf</span> <span class="hljs-string">&quot;%02d&quot;</span> <span class="hljs-string">&quot;<span class="hljs-variable">$index</span>&quot;</span>)<br><br>                <span class="hljs-comment"># 使用 ffmpeg 将 .m3u8 文件转换为 .ts 文件</span><br>                ffmpeg -i <span class="hljs-string">&quot;<span class="hljs-variable">$file</span>&quot;</span> -c copy <span class="hljs-string">&quot;<span class="hljs-variable">$&#123;formatted_index&#125;</span>.ts&quot;</span><br><br>                <span class="hljs-comment"># 将生成的 .ts 文件转换为 .mp4 文件</span><br>                ffmpeg -i <span class="hljs-string">&quot;<span class="hljs-variable">$&#123;formatted_index&#125;</span>.ts&quot;</span> -c copy <span class="hljs-string">&quot;<span class="hljs-variable">$&#123;formatted_index&#125;</span>.mp4&quot;</span><br><br>                <span class="hljs-comment"># 拷贝 .mp4 文件到指定目录，并加上前缀</span><br>                cp <span class="hljs-string">&quot;<span class="hljs-variable">$&#123;formatted_index&#125;</span>.mp4&quot;</span> <span class="hljs-string">&quot;<span class="hljs-variable">$&#123;target_dir&#125;</span>/<span class="hljs-variable">$&#123;pre_str&#125;</span><span class="hljs-variable">$&#123;formatted_index&#125;</span>.mp4&quot;</span><br><br>                <span class="hljs-built_in">echo</span> <span class="hljs-string">&quot;Directory #<span class="hljs-variable">$index</span> processed successfully, copied to target directory as aaa<span class="hljs-variable">$&#123;formatted_index&#125;</span>.mp4.&quot;</span><br>				<br>				<span class="hljs-comment"># 删除生成的 .ts 和 .mp4 文件</span><br>                rm -f <span class="hljs-string">&quot;<span class="hljs-variable">$&#123;formatted_index&#125;</span>.ts&quot;</span> <span class="hljs-string">&quot;<span class="hljs-variable">$&#123;formatted_index&#125;</span>.mp4&quot;</span><br>            <span class="hljs-keyword">else</span><br>                <span class="hljs-built_in">echo</span> <span class="hljs-string">&quot;No .m3u8 files found in <span class="hljs-variable">$dir</span>&quot;</span><br>            <span class="hljs-keyword">fi</span><br>        <span class="hljs-keyword">done</span><br><br>        <span class="hljs-comment"># 返回上一级目录</span><br>        <span class="hljs-built_in">cd</span> ..<br><br>        <span class="hljs-comment"># 递增目录序号</span><br>        index=$((index + <span class="hljs-number">1</span>))<br>    <span class="hljs-keyword">fi</span><br><span class="hljs-keyword">done</span><br></code></pre></td></tr></table></figure>
            </div>
            <hr>
            <div>
              <div class="post-metas mb-3">
                
                  <div class="post-meta mr-3">
                    <i class="iconfont icon-category"></i>
                    
                      <a class="hover-with-bg" href="/categories/%E5%BA%94%E7%94%A8/">应用</a>
                    
                  </div>
                
                
                  <div class="post-meta">
                    <i class="iconfont icon-tags"></i>
                    
                      <a class="hover-with-bg" href="/tags/ffmpeg/">ffmpeg</a>
                    
                  </div>
                
              </div>
              
                <p class="note note-warning">
                  
                    本博客所有文章除特别声明外，均采用 <a target="_blank" href="https://creativecommons.org/licenses/by-sa/4.0/deed.zh" rel="nofollow noopener noopener">CC BY-SA 4.0 协议</a> ，转载请注明出处！
                  
                </p>
              
              
                <div class="post-prevnext">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2024/11/06/06%E6%9D%82%E9%A1%B9/02hexo%E5%88%9B%E5%BB%BA%E7%AB%99%E7%82%B9/">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">hexo+github+gitee创建个人站点</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2024/08/07/04DevOps/34linux%E6%8C%87%E5%AE%9A%E7%9B%AE%E5%BD%95%E6%90%9C%E7%B4%A2%E6%88%96%E9%93%BE%E6%8E%A5so/">
                        <span class="hidden-mobile">linux指定目录搜索或链接so</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>
    
      <div class="d-none d-lg-block col-lg-2 toc-container" id="toc-ctn">
        <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div class="toc-body" id="toc-body"></div>
</div>

      </div>
    
  </div>
</div>

<!-- Custom -->


    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v"
                 for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>
    

    
  </main>

  <footer class="text-center mt-5 py-3">
  <div class="footer-content">
     <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
  </div>
  

  

  
</footer>


  <!-- SCRIPTS -->
  
  <script  src="https://cdn.jsdelivr.net/npm/nprogress@0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nprogress@0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js" ></script>
<script  src="https://cdn.jsdelivr.net/npm/bootstrap@4/dist/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>

<!-- Plugins -->


  <script  src="/js/local-search.js" ></script>



  
    <script  src="/js/img-lazyload.js" ></script>
  



  



  
    <script  src="https://cdn.jsdelivr.net/npm/tocbot@4/dist/tocbot.min.js" ></script>
  
  
    <script  src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3/dist/jquery.fancybox.min.js" ></script>
  
  
    <script  src="https://cdn.jsdelivr.net/npm/anchor-js@4/anchor.min.js" ></script>
  
  
    <script defer src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js" ></script>
  






  <script  src="https://cdn.jsdelivr.net/npm/typed.js@2/lib/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var title = document.getElementById('subtitle').title;
      
        typing(title);
      
    })(window, document);
  </script>















<!-- 主题的启动项 保持在最底部 -->
<script  src="/js/boot.js" ></script>


</body>
</html>
